using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Reflection;

namespace OracleInternal.SqlAndPlsqlParser
{
	internal abstract class ParserGrammarReservedWordsAndKeywords
	{
		public abstract string[] ReservedWords
		{
			get;
		}

		public abstract string[] Keywords
		{
			get;
		}

		public ParserGrammarReservedWordsAndKeywords()
		{
		}

		public static string[] ReadCompressedDataFromManifest(string resourceName)
		{
			List<string> list = new List<string>();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
			{
				using GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress);
				MemoryStream memoryStream = new MemoryStream();
				gZipStream.CopyTo(memoryStream);
				memoryStream.Position = 0L;
				InputStream inputStream = new InputStream(memoryStream);
				if (inputStream != null)
				{
					while (!inputStream.EndOfStream)
					{
						string text = inputStream.ReadLine()!.Trim();
						if (!text.StartsWith("#") && text.Length != 0)
						{
							list.Add(text);
						}
					}
				}
			}
			return list.ToArray();
		}

		public static string[] ReadDataFromManifest(string resourceName)
		{
			List<string> list = new List<string>();
			using (Stream sr = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
			{
				InputStream inputStream = new InputStream(sr);
				if (inputStream != null)
				{
					while (!inputStream.EndOfStream)
					{
						string text = inputStream.ReadLine()!.Trim();
						if (!text.StartsWith("#") && text.Length != 0)
						{
							list.Add(text);
						}
					}
				}
			}
			return list.ToArray();
		}
	}
}
